//
//  AlbumCollectionViewCell.m
//  DolphinMusic
//
//  Created by dllo on 15/3/25.
//  Copyright (c) 2015年 蓝鸥科技. All rights reserved.
//

#import "AlbumCollectionViewCell.h"

@implementation AlbumCollectionViewCell

- (void)dealloc
{
    [_view1 release];
    [_coverImageView release];
    [_album release];
    [_titleLabel release];
    [_arrowImageVIew release];
    [super dealloc];
}

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        self.coverImageView = [[UIImageView alloc] init];
        [self.contentView addSubview:self.coverImageView];
        [_coverImageView release];
        
        self.titleLabel = [[UILabel alloc] init];
        [self.contentView addSubview:self.titleLabel];
        [_titleLabel release];
        
        self.arrowImageVIew = [[UIImageView alloc] init];
        [self.contentView addSubview:self.arrowImageVIew];
        [_arrowImageVIew release];
        
        self.view1 = [[UIView alloc] init];
        [self.contentView addSubview:self.view1];
        [_view1 release];
        
    }
    return self;
}

- (void)applyLayoutAttributes:(UICollectionViewLayoutAttributes *)layoutAttributes
{
    [super applyLayoutAttributes:layoutAttributes];
}


- (void)setAlbum:(Album *)album
{
    if (_album != album) {
        [_album release];
        _album = [album retain];
    }
    
    self.coverImageView.frame = CGRectMake(20, 5, 70, 70);
    [self.coverImageView setImageWithURL:[NSURL URLWithString:[album.pic_big stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]]];
    
    self.titleLabel.frame = CGRectMake(100, 25, self.contentView.frame.size.width - 50 - 80, 30);
    self.titleLabel.text = album.title;
    
    self.arrowImageVIew.frame = CGRectMake(self.contentView.frame.size.width - 40, 30, 20, 20);
    self.arrowImageVIew.image = [UIImage imageNamed:@"arrowNext.png"];
    self.arrowImageVIew.alpha = 0.6;
    
    self.view1.frame = CGRectMake(0, self.contentView.frame.size.height - 1, self.contentView.frame.size.width, 1);
    self.view1.backgroundColor = [UIColor blackColor];
    self.view1.alpha = 0.1;
}





@end
